{
  "properties" : { },
  "id" : "5282297538fa435189a358bc360de129",
  "script" : null,
  "groupId" : "5b4c0f1fcedc4bfbbf84bb3791e01399",
  "name" : "查询规则列表",
  "createTime" : 1727070943771,
  "updateTime" : 1724816542500,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "list",
  "method" : "GET",
  "parameters" : [ {
    "name" : "ruleName",
    "value" : "异常",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "ruleMetricId",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "level",
    "value" : "5",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 2,\n        \"current\": 1,\n        \"size\": 30,\n        \"records\": [\n            {\n                \"id\": \"99999\",\n                \"ruleName\": \"ping异常\",\n                \"suppressInterval\": \"-1\",\n                \"ruleMetricId\": \"99995\",\n                \"level\": \"5\",\n                \"expression\": \"=1\",\n                \"templateContent\": \"msg\",\n                \"expressionType\": \"event\",\n                \"unit\": \"\",\n                \"rowId\": \"1\"\n            },\n            {\n                \"id\": \"99996\",\n                \"ruleName\": \"温度异常\",\n                \"suppressInterval\": \"0\",\n                \"ruleMetricId\": \"99992\",\n                \"level\": \"5\",\n                \"expression\": \">45\",\n                \"templateContent\": \"温度高于v摄氏度\",\n                \"expressionType\": \"num\",\n                \"unit\": \"℃\",\n                \"rowId\": \"2\"\n            }\n        ]\n    }\n}",
  "description" : "查询告警规则",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Array",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1724666441605",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "42",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
var sql = """
    SELECT * FROM alarm_rule
    <where>
        <if test="ruleName != null and ruleName != ''">
            AND rule_name LIKE  CONCAT('%',#{ruleName} ,'%')
        </if>
        <if test="ruleMetricId != null and ruleMetricId != ''">
            AND rule_metric_id = #{ruleMetricId}
        </if>
        <if test="level != null and level != ''">
            AND level = #{level}
        </if>
    </where>
"""

return db.page(sql) 
